﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DAL;

public partial class index : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    //用户登录
    protected void submit_Click(object sender, EventArgs e)
    {
        string account = Account.Text.Trim();
        string password = Password.Text.Trim();

        int result;

        result = new Account().CheckLogin(account, password);
        if (result == 0)
            ErrorMsg.Text = "用户名错误";
        else
            ErrorMsg.Text = "密码错误";

        if (result == 2)
        {
            Sys_Account acc = new Account().GetAccountByAccount(account);
            Session["UserKey"] = acc.UserKey;
            Session["Account"] = acc.Account;
            Session["UserType"] = acc.UserType;

            if ( Convert.ToInt32(Session["UserType"])== 1 )   //客户
                Response.Redirect("Business/Business.aspx?menutype=113");
            else
                Response.Redirect("Business/Business_NotFinish.aspx?menutype=121");
        }
    }
}
